//
//  GWChatInputView.h
//  CloudDoctorApp
//
//  Created by hushaohui on 16/5/24.
//  Copyright © 2016年 GoWin. All rights reserved.
//
#define KMinHeight 45.0f
#define KYYKeyBoard [YYKeyboardManager defaultManager]
#define kFunctionViewHeight 210.f
#define SCREEN_Height_HU [[UIScreen mainScreen]bounds].size.height
#define SCREEN_Width_HU [[UIScreen mainScreen]bounds].size.width
#define StatusBar_HEIGHT 20

#import <MapKit/MapKit.h>
#import <UIKit/UIKit.h>
#import "HPGrowingTextView.h"
#import "Mp3Recorder.h"
#import <AVFoundation/AVFoundation.h>
#import "HUFaceManager.h"

/**
 *  functionView 类型
 */
typedef NS_ENUM(NSUInteger, GWFunctionViewShowType){
    GWFunctionViewShowNothing   /**< 不显示functionView */,
    GWFunctionViewShowFace      /**< 显示表情View */,
    GWFunctionViewShowVoice     /**< 显示录音view */,
    GWFunctionViewShowMore      /**< 显示更多view */,
    GWFunctionViewShowKeyboard  /**< 显示键盘 */,
};


@protocol GWChatBarDelegate;

/**
 *  仿微信信息输入框,支持语音,文字,表情,选择照片,拍照
 */

@interface GWChatInputView : UIView
@property (weak, nonatomic) id<GWChatBarDelegate> delegate;
@property (nonatomic, assign) BOOL isFirstResponse;    ///< 是否第一响应者
@property (nonatomic, assign) GWKeyboardType type;
@property (nonatomic, assign) GWFunctionViewShowType showType;
@property (nonatomic, weak) UIViewController* viewController;

@property (nonatomic, assign) BOOL isGrow;
//显示输入框
- (void)show;
//隐藏输入框
- (void)hide;

/**
 *  结束输入状态
 */
- (void)endInputing;
/**
 *  将文字中带表情的字符处理换成图片显示
 *
 *  @param text 未处理的文字
 *
 *  @return 处理后的文字
 */
+ (NSMutableAttributedString *)emotionStrWithString:(NSString *)text URLBlock:(URLBlock)URLBlock;


+ (instancetype)shareManager;
/**
 *  播放语音
 *
 *  @param voiceData 语音data
 */
- (void)playVoiceFile:(NSData *)voiceData;
/**
 *  停止播放
 */
- (void)stopPlayVoiceFile;
@end

/**
 *  HUChatBar代理事件,发送图片,地理位置,文字,语音信息等
 */
@protocol GWChatBarDelegate <NSObject>

@optional



/**
 *  发送图片信息,支持多张图片
 *
 *  @param chatBar
 *  @param pictures 需要发送的图片信息
 */
- (void)chatBar:(GWChatInputView *)chatBar sendPictures:(NSArray *)pictures;

/**
 *  发送地理位置信息
 *
 *  @param chatBar
 *  @param locationCoordinate 需要发送的地址位置经纬度
 *  @param locationText       需要发送的地址位置对应信息
 */
- (void)chatBar:(GWChatInputView *)chatBar sendLocation:(CLLocationCoordinate2D)locationCoordinate locationText:(NSString *)locationText;

/**
 *  发送普通的文字信息,可能带有表情
 *
 *  @param chatBar
 *  @param message 需要发送的文字信息
 */
- (void)chatBar:(GWChatInputView *)chatBar sendMessage:(NSString *)message;

/**
 *  发送语音信息
 *
 *  @param chatBar
 *  @param voiceData 语音data数据
 *  @param seconds   语音时长
 */
- (void)chatBar:(GWChatInputView *)chatBar sendVoice:(NSString *)voiceFileName seconds:(NSTimeInterval)seconds;
/**
 *  开启视频聊天
 */
- (void)chatBarStartVedio;
/**
 *  点击病例按钮
 */
- (void)chatBarSendCase;
/**
 *  开始编辑
 *
 *  @param textView 输入框
 */
- (void)chatBarTextViewDidBeginEditing:(HPGrowingTextView *)textView;
/**
 *  结束编辑
 *
 *  @param textView 输入框 
 */
- (void)chatBarTextViewDidEndEditing:(HPGrowingTextView *)textView;
/**
 *  改变编辑状态
 *
 *  @param textView 输入框
 */
- (void)chatBarTextViewDidChangeEditing:(HPGrowingTextView *)textView;
/**
 *  输入框改变高度
 *
 *  @param textView 输入框
 */
- (void)chatBarGrowingTextViewEditing:(HPGrowingTextView *)textView;
/**
 *  输入框改变高度
 *
 *  @param changeHeight 改变高度
 *  @param toType       当前状态
 */
- (void)chatBarChangeHeight:(CGFloat)changeHeight toType:(GWFunctionViewShowType)toType;
/**
 *  播放完成代理方法
 *
 *  @param player self.MP3
 *  @param flag   flag
 */
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag;
@end
